﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cashautomat
{
    class Model
    {
        string cardNum, Pin;
        int balance;
        bool logedin = false;
        public Model(string cardNum, string Pin, int balance)
        {
        int balance;
        public Model(string cardNum, string Pin, int balance)
        {
            string cadrNumber = cardNum;
            string PIN = Pin;
            int Balance = balance;
            
        }
        public bool login(string cardNumber, string PIN)
        {
            bool jel = false;
            int kezdo = cardNumber.Length;
            int i = kezdo - 4;
            do
            {
                if (cardNumber[i] == PIN[i])
                {
                    i++;
                }
            }
            while (i < kezdo);
            if (i < kezdo)
            {
                jel = false;
            }
            else
            {
                jel = true;
                logedin = true;
            }
            return jel;
        }
        public void logout()
        
        public bool setLogedin
        {
            set
            {
                logedin = value;
            }
        {

        }
        public int getBalance
        {
            get
            {
                return balance;
            }
        }
        public bool takeCash(int amount)
        {
            bool jel=false;
            if (amount - balance > 0)
            {
                balance = balance - amount;
                jel = true;
            }
            return jel;
        }
    }
    

}
